package org.idea.qiyu.framework.rpc.dubbo.router.starter.zone;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.registry.zookeeper.ZookeeperRegistry;
import org.apache.dubbo.remoting.zookeeper.ZookeeperTransporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author linhao
 * @Date created in 4:19 下午 2021/8/1
 */
public class ZoneAwareZookeeperRegister extends ZookeeperRegistry {

    private static final Logger LOGGER = LoggerFactory.getLogger(ZoneAwareZookeeperRegister.class);

    public ZoneAwareZookeeperRegister(URL url, ZookeeperTransporter zookeeperTransporter) {
        super(url, zookeeperTransporter);
    }

    @Override
    public void doRegister(URL url) {
        String zone = System.getProperty("zone");
        url = url.addParameter("zone",zone);
        LOGGER.info("url is {}",url);
        super.doRegister(url);
    }

}
